#!/bin/bash -
#=======================================================================
#
#          FILE: netconsole_devel_set.sh
#         USAGE: ./netconsole_devel_set.sh <ip>
#   DESCRIPTION: Set netconsole on development machine
#  REQUIREMENTS: netconsole
#          BUGS: N/A
#         NOTES: N/A
#        AUTHOR: Ali Ayoub
#         EMAIL: ali@mellanox.com
#       COMPANY: N/A
#       CREATED: 09.17.2010-15:24:52
#      REVISION: 1.1
#=======================================================================

USAGE="Usage: $0 <monitor-server-ip>"
EXAMPLE="Example: $0 10.20.1.20"

if [ $# != 1 ]; then
  echo $USAGE
  echo $EXAMPLE
  exit 1
fi


ip=$1

egrep -v '^$|^#|SYSLOGADDR=' /etc/sysconfig/netconsole > /etc/sysconfig/netconsole.new
echo "SYSLOGADDR=$ip" >> /etc/sysconfig/netconsole.new
\cp /etc/sysconfig/netconsole /etc/sysconfig/netconsole.orig
\mv /etc/sysconfig/netconsole.new /etc/sysconfig/netconsole

dmesg -n 8
chkconfig netconsole on
/etc/init.d/netconsole restart
rc=$?
echo "-I- Done [$rc]."
exit $rc

rmmod netconsole
insmod /lib/modules/2.6.32.21-15xen/kernel/drivers/net/netconsole.ko netconsole=6666@10.20.4.153/eth1,514@10.20.1.20/00:30:48:7D:DE:E4
dmesg -n 8
rmmod tun
modprobe tun

